import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

import persist from "vuex-persist";

export default new Vuex.Store({
  state: {
    user: "",
    user_id:'',
    getshops:[],
    list:[],
    collectlist:[],
  },
  mutations: {
    login(state, val) {
      state.user = val.userName;
      state.user_id=val.user_id;
      localStorage.setItem("token", "wasadasdaswcce-sasddsasd-wscaascasccsdcc");
    },
    logout(state, val) {
      state.user = "";
      state.user_id="";
      localStorage.removeItem("token");
    },
    add(state,val){
      state.list=val;
    },
  },
  actions: {},
  modules: {},
  plugins: [
    new persist({
      storage: window.localStorage,
    }).plugin,
  ],
});
